home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / auto-l1a / idd_main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-03-30  |  7.5 KB  |  213 lines

  1. VERSION 5.00
  2. Begin VB.Form IDD_Main 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "NT AutoLogin "
  5.    ClientHeight    =   3405
  6.    ClientLeft      =   45
  7.    ClientTop       =   615
  8.    ClientWidth     =   2580
  9.    Icon            =   "IDD_Main.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3405
  14.    ScaleWidth      =   2580
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.TextBox IDE_ReEnterPassword 
  17.       Height          =   285
  18.       IMEMode         =   3  'DISABLE
  19.       Left            =   120
  20.       PasswordChar    =   "*"
  21.       TabIndex        =   3
  22.       Top             =   1800
  23.       Width           =   2295
  24.    End
  25.    Begin VB.CommandButton IDCM_Exit 
  26.       Caption         =   "Exit"
  27.       Height          =   375
  28.       Left            =   1320
  29.       TabIndex        =   6
  30.       Top             =   2880
  31.       Width           =   1095
  32.    End
  33.    Begin VB.CommandButton IDCM_Save 
  34.       Caption         =   "Save"
  35.       Height          =   375
  36.       Left            =   120
  37.       TabIndex        =   5
  38.       Top             =   2880
  39.       Width           =   1095
  40.    End
  41.    Begin VB.TextBox IDE_Username 
  42.       Height          =   285
  43.       Left            =   120
  44.       TabIndex        =   1
  45.       Top             =   600
  46.       Width           =   2295
  47.    End
  48.    Begin VB.TextBox IDE_Password 
  49.       Height          =   285
  50.       IMEMode         =   3  'DISABLE
  51.       Left            =   120
  52.       PasswordChar    =   "*"
  53.       TabIndex        =   2
  54.       Top             =   1200
  55.       Width           =   2295
  56.    End
  57.    Begin VB.TextBox IDE_Domain 
  58.       Height          =   285
  59.       Left            =   120
  60.       TabIndex        =   4
  61.       Top             =   2400
  62.       Width           =   2295
  63.    End
  64.    Begin VB.CheckBox IDCK_AutoLogin 
  65.       Caption         =   "Use AutoLogin"
  66.       Height          =   375
  67.       Left            =   120
  68.       TabIndex        =   0
  69.       Top             =   0
  70.       Width           =   2055
  71.    End
  72.    Begin VB.Label IDL_ReEnterPassword 
  73.       AutoSize        =   -1  'True
  74.       Caption         =   "Re-enter Password"
  75.       Height          =   195
  76.       Left            =   120
  77.       TabIndex        =   10
  78.       Top             =   1560
  79.       Width           =   1350
  80.    End
  81.    Begin VB.Label IDL_Username 
  82.       AutoSize        =   -1  'True
  83.       Caption         =   "User Name"
  84.       Height          =   195
  85.       Left            =   120
  86.       TabIndex        =   9
  87.       Top             =   360
  88.       Width           =   795
  89.    End
  90.    Begin VB.Label IDL_Password 
  91.       AutoSize        =   -1  'True
  92.       Caption         =   "Password"
  93.       Height          =   195
  94.       Left            =   120
  95.       TabIndex        =   8
  96.       Top             =   960
  97.       Width           =   690
  98.    End
  99.    Begin VB.Label IDL_Domain 
  100.       AutoSize        =   -1  'True
  101.       Caption         =   "Domain"
  102.       Height          =   195
  103.       Left            =   120
  104.       TabIndex        =   7
  105.       Top             =   2160
  106.       Width           =   540
  107.    End
  108.    Begin VB.Menu IDM_About 
  109.       Caption         =   "About"
  110.    End
  111. Attribute VB_Name = "IDD_Main"
  112. Attribute VB_GlobalNameSpace = False
  113. Attribute VB_Creatable = False
  114. Attribute VB_PredeclaredId = True
  115. Attribute VB_Exposed = False
  116. Option Explicit
  117. Private Sub Form_Load()
  118.     If OperatingSystemVersion = WindowsNT Then
  119.         IDCK_AutoLogin.Value = GetSettingSpecial("CurrentVersion", "WinLogon", "AutoAdminLogon", 0, HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  120.         IDE_Username.Text = GetSettingSpecial("CurrentVersion", "WinLogon", "DefaultUserName", "", HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  121.         IDE_Password.Text = GetSettingSpecial("CurrentVersion", "WinLogon", "DefaultPassword", "", HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  122.         IDE_ReEnterPassword.Text = IDE_Password.Text
  123.         IDE_Domain.Text = GetSettingSpecial("CurrentVersion", "WinLogon", "DefaultDomainName", "", HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  124.     Else
  125.         Call MsgBox("AutoLogin is only for Windows NT 4.0.  Please download TweakUI for 95.", vbOKOnly, "Exiting AutoLogin")
  126.         Unload Me
  127.     End If
  128.     Call IDCK_AutoLogin_Click
  129.     IDCM_Save.Enabled = False
  130. End Sub
  131. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  132. Dim ret As Integer
  133.     If IDCM_Save.Enabled = True Then
  134.         ret = MsgBox("Do you want to save these settings?", vbYesNo + vbQuestion, "Exit AutoLogin")
  135.         If ret = vbYes Then
  136.             Call IDCM_Save_Click
  137.             Unload Me
  138.         Else
  139.             Unload Me
  140.         End If
  141.     Else
  142.         Unload Me
  143.     End If
  144. End Sub
  145. Private Sub IDCK_AutoLogin_Click()
  146.     IDCM_Save.Enabled = True
  147.     If IDCK_AutoLogin.Value = vbUnchecked Then
  148.         IDL_Username.Enabled = False
  149.         IDL_Password.Enabled = False
  150.         IDL_ReEnterPassword.Enabled = False
  151.         IDL_Domain.Enabled = False
  152.         IDE_Username.Enabled = False
  153.         IDE_Password.Enabled = False
  154.         IDE_ReEnterPassword.Enabled = False
  155.         IDE_Domain.Enabled = False
  156.     Else
  157.         IDL_Username.Enabled = True
  158.         IDL_Password.Enabled = True
  159.         IDL_ReEnterPassword.Enabled = True
  160.         IDL_Domain.Enabled = True
  161.         IDE_Username.Enabled = True
  162.         IDE_Password.Enabled = True
  163.         IDE_ReEnterPassword.Enabled = True
  164.         IDE_Domain.Enabled = True
  165.     End If
  166. End Sub
  167. Private Sub IDCM_Exit_Click()
  168.     Unload Me
  169. End Sub
  170. Private Sub IDCM_Save_Click()
  171.     If IDE_Password.Text <> IDE_ReEnterPassword.Text Then
  172.         Call MsgBox("Passwords do not match", vbCritical + vbOKOnly, "Error")
  173.         IDE_Password.SetFocus
  174.         Exit Sub
  175.     End If
  176.     Call SaveSettingSpecial("CurrentVersion", "WinLogon", "AutoAdminLogon", IDCK_AutoLogin.Value, HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  177.     Call SaveSettingSpecial("CurrentVersion", "WinLogon", "DefaultUserName", IDE_Username.Text, HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  178.     Call SaveSettingSpecial("CurrentVersion", "WinLogon", "DefaultPassword", IDE_Password.Text, HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  179.     Call SaveSettingSpecial("CurrentVersion", "WinLogon", "DefaultDomainName", IDE_Domain.Text, HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT")
  180.     IDCM_Save.Enabled = False
  181. End Sub
  182. Private Sub IDE_Domain_Change()
  183.        IDCM_Save.Enabled = True
  184. End Sub
  185. Private Sub IDE_Domain_GotFocus()
  186.     IDE_Domain.SelStart = 0
  187.     IDE_Domain.SelLength = Len(IDE_Domain.Text)
  188. End Sub
  189. Private Sub IDE_Password_Change()
  190.     IDCM_Save.Enabled = True
  191. End Sub
  192. Private Sub IDE_Password_GotFocus()
  193.     IDE_Password.SelStart = 0
  194.     IDE_Password.SelLength = Len(IDE_Password.Text)
  195. End Sub
  196. Private Sub IDE_ReEnterPassword_Change()
  197.     IDCM_Save.Enabled = True
  198. End Sub
  199. Private Sub IDE_ReEnterPassword_GotFocus()
  200.     IDE_ReEnterPassword.SelStart = 0
  201.     IDE_ReEnterPassword.SelLength = Len(IDE_ReEnterPassword.Text)
  202. End Sub
  203. Private Sub IDE_Username_Change()
  204.     IDCM_Save.Enabled = True
  205. End Sub
  206. Private Sub IDE_Username_GotFocus()
  207.     IDE_Username.SelStart = 0
  208.     IDE_Username.SelLength = Len(IDE_Username.Text)
  209. End Sub
  210. Private Sub IDM_About_Click()
  211.     Call MsgBox("AutoLogin Tool v" & App.Major & "." & App.Minor & "." & App.Revision & " for Windows NT 4.0 - Paul Mather - April 1999", vbOKOnly, "About")
  212. End Sub
  213.